<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // dp数组的定义：dp[i] 表示以 nums[i] 这个数结尾的最长递增子序列的长度
    var lengthOfLIS = function (nums) {
      let dp = new Array(nums.length).fill(1)
      for (let i = 0; i < nums.length; i++) {
        for (let j = 0; j < i; j++) {
          if (nums[i] > nums[j]) {
            dp[i] = Math.max(dp[i], dp[j] + 1)
          }
        }
      }
      return Math.max(...dp)
    }
  </script>
</body>

</html>